function AdminHome() {
	commonHome.log( "[AdminHome]" );

	bindEvents();

	function bindEvents() {

		$("nav#menu a").live( 'click', function( event ) {
			event.preventDefault();
			var viewPage = $(event.currentTarget).attr('viewPage');
			ajaxProxy.doAjaxRequest({
				url: '/turnos/' + viewPage,
				success: function( data ) {
					$("#viewPage").html(data);
				},
				error: function( data ) {
					commonHome.log( "error" );
				}
			});
		});

		$("table#listUsers a, table#listAppointments a").live( 'click', function( event ) {
			event.preventDefault();
			var viewPage = $(event.currentTarget).attr('viewPage');
			ajaxProxy.doAjaxRequest({
				url: '/turnos/' + viewPage,
				success: function( data ) {
					$("#addEditPage").html(data);
				},
				error: function( data ) {
					commonHome.log( "error" );
				}
			});
		});

		$("form#addEditUserForm a#submit").live( 'click', function( event ) {
			event.preventDefault();
			ajaxProxy.doAjaxRestRequest({
				type: 'POST',
				url: '/turnos/rest/save/user',
				data: $("form#addEditUserForm").serialize(),
				success: function( data ) {
					commonHome.log( "success" );
					commonHome.log( data );
				},
				error: function( data ) {
					commonHome.log( "error" );
					commonHome.log( data );
				}
			});
//			$.ajax({
//				type: 'POST',
//				url: '/turnos/rest/save/user',
//				data: $("form#addEditUserForm").serialize(),
//				error: function( data ) {
//					commonHome.log( "error" );
//					commonHome.log( data );
//					var response = jQuery.parseJSON( data.data );
//					commonHome.log( response );
//				},
//				success: function( data ) {
//					commonHome.log( "success" );
//					commonHome.log( commonHome.hasCompleteData( data ) )
//					
//					commonHome.log( data );
//				}
//			});
			return false;
		});

		$("form#addEditAppointmentForm a#submit").live( 'click', function( event ) {
			event.preventDefault();
			ajaxProxy.doAjaxRestRequest({
				type: 'POST',
				url: '/turnos/rest/save/appointment',
				data: $("form#addEditAppointmentForm").serialize(),
				success: function( data ) {
					commonHome.log( "success" );
					commonHome.log( data );
				},
				error: function( data ) {
					commonHome.log( "error" );
					commonHome.log( data );
				}
			});
			return false;
		});
	}
}

var adminHome = new AdminHome();